package top.fangw.admin.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import top.fangw.admin.pojo.entity.SysRoleJoinUser;
import top.fangw.admin.mapper.SysRoleJoinUserMapper;
import top.fangw.admin.service.ISysRoleJoinUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.fangw.common.api.vo.InitUserJoinRoleVo;
import top.fangw.common.mybatis.annotation.DyDataSource;

/**
 * <p>
 * 用途：人员与角色的关联关系表 服务实现类
 * </p>
 *
 * @author fangw
 * @since 2024-03-02
 */
@Service
@DS("base_info")
public class SysRoleJoinUserServiceImpl extends ServiceImpl<SysRoleJoinUserMapper, SysRoleJoinUser> implements ISysRoleJoinUserService {

    @Override
    @DyDataSource(tenantId = "#initUserJoinRoleVo.tenantId", autoTenantId = false)
    public void initUserJoinRole(InitUserJoinRoleVo initUserJoinRoleVo) {
        SysRoleJoinUser sysRoleJoinUser = BeanUtil.copyProperties(initUserJoinRoleVo, SysRoleJoinUser.class);
        this.baseMapper.insert(sysRoleJoinUser);
    }
}
